<?php include_once './application/views/sys_admin/common/header.php';  ?>
<div class=" definewidth m20">
		<table class="table table-bordered table-hover definewidth m10">
			 <thead>
			    <tr>
			        <th><strong>编号</strong></th>
					<th><strong>用户名</strong></th>
					<th><strong>申请类型</strong></th>
					<th><strong>原来额度</strong></th>
					<th><strong>申请额度</strong></th>
					<th><strong>新额度</strong></th>
					<th><strong>申请时间</strong></th>
					<th><strong>申请备注</strong></th>
					<th><strong>审核备注</strong></th>
					<th><strong>状态</strong></th>
					<th><strong>操作</strong></th>
			    </tr>
			   </thead>
			     <?php foreach($amount_apply_list as $apply){?>
			  <tr>
				<td><?php echo $apply['id'];?></td>
				<td><?php echo $apply['username'];?></td>
				<td>信用额度</td>
				<td><?php echo number_format($apply['account_old'],2);?></td>
				<td><?php echo number_format($apply['account'],2);?></td>
				<td><?php echo number_format($apply['account_new'],2);?></td>
				<td><?php echo date('Y-m-d H:i',$apply['add_time']);?></td>
				<td><?php echo $apply['remark'];?></td>
				<td><?php echo $apply['verify_remark'];?></td>
				<td><?php echo $amount_status[$apply['fstatus']];?></td>
				<td id="chebiao_<?php echo $apply['id'];?>" >
					<?php if($apply['fstatus'] == 0){?>
					<a href="javascript:verify(<?php echo $apply['id'];?>)" >审核</a>
					<?php }?>
				</td>
			  </tr>
			  <?php }?>
			  	<tr>
			  	<td colspan="8"  class="page"><?php echo $this->pagination->create_links();?></td>
			  	</tr>
		</table>
</div>
<!-- admin_main end -->
<div id="dialog" title="系统提示" style="display:none;">
<div id="msg" style="text-align:center;color:red">&nbsp;</div>
<input type="hidden" name="id" id="id" />
状态：<input type="radio" name="fstatus" id="fstatus" checked="checked" value="1"/>审核通过 
	  <input type="radio" name="fstatus" id="fstatus" value="2"/>审核不通过 <br /><br />
备注：<textarea  id="verify_remark" name="verify_remark" style="width: 300px;height: 100px;">通过审核</textarea><br />
</div>
<script>
function verify(id){
	if(id>0){
		$( "#dialog" ).dialog({
			width:400,
			modal:true, //蒙层（弹出会影响页面大小）
			title:'提现审核',
			buttons:{"提交":function(){verifysub();},"关闭":function(){$(this).dialog("close");}}
		});
		$("#id").val(id);
	}
}

function verifysub(){
	$( "#dialog" ).dialog();
	if($('#verify_remark').val() == ''){
		$("#msg").html("请填写备注");
		return false;
	}
	$( "#dialog" ).dialog({
		width:400,
		modal:true, //蒙层（弹出会影响页面大小）
		title:'提现审核',
		buttons:{"提交":function(){},"关闭":function(){}}
	});
	$.ajax({
			type: "POST",
			url: "/sys_admin/amount/verify",
			data: "id="+$('#id').val()+"&fstatus="+$('input:radio[name="fstatus"]:checked').val()+"&verify_remark="+$('#verify_remark').val(),
			success: function(msg){
		        $( "#dialog" ).dialog();
		        if(msg=='1'){
		        	$("#msg").html("操作成功");
		        }else{
		        	$("#msg").html("操作失败，请联系管理员。");
			    }
				setTimeout(function(){
						location.reload();
				},3000);
			},
			dataType: "text"
		});
}
</script>
